#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdlib.h>
int main(void)
{
    pid_t id=fork();
    int status=0;
    if(id==0)//子进程
    {
        printf("child process...\n");
        sleep(2);
        execl("/usr/bin/ls","ls","-a","-l","-i",NULL);
        exit(12);
    }
    else //父进程
    {
        sleep(5);
        printf("father process...\n");
        pid_t ret=waitpid(id,&status,0);
        
        printf("exit code:%d,signal:%d\n",(status>>8)&0xFF,status&0x7F);

    }
    return 0;
}
